var util = require('../../../../utils/util.js');
var api = require('../../../../config/api.js');
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    orderInfo: {
      type: Object,
      value: ''
    },
    //修改按钮显示
    isHidden: {
      type: Boolean,
      value: true
    }, 
  },

  /**
   * 组件的初始数据
   */
  data: {
    problem: "", //问题
    introduction: "", //介绍
  },

  /**
   * 组件的方法列表
   */
  methods: {
    commit: function() {
      //校验用户手机号码
      var phoneNum = wx.getStorageSync('userInfo').phoneNum
      if (!phoneNum) {
        //跳转到验证手机号页面
        wx.navigateTo({
          url: '../../myPages/mobileChecking/mobileChecking?userOrderId=' + this.properties.orderInfo.id + '&body=' + this.properties.orderInfo.topic_name + '&price=' + this.properties.orderInfo.price + '&topic_name=' + this.properties.orderInfo.topic_name
        })
      }else{
        //校验
        if (this.properties.orderInfo.id == undefined || this.properties.orderInfo.topic_name == undefined) {
          wx.showToast({
            title: '支付缺少必要参数',
            icon: 'none'
          });
        }
        wx.navigateTo({
          url: '/myPages/payment/payment?userOrderId=' + this.properties.orderInfo.id + '&body=' + this.properties.orderInfo.topic_name + '&price=' + this.properties.orderInfo.price + '&topic_name=' + this.properties.orderInfo.topic_name
        })
        //設爲支付標志
        this.triggerEvent('myeventB', 'payment')
      }
    },
    //返回修改
    update(){
      wx.redirectTo({
        url: '/myPages/process/process?action=' + 'update' + '&orderId=' + this.data.orderInfo.id,
      })
    }
  },

  ready: function() {

  }
})